package com.notecalendar.quartz.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * Exception for methods on QuartzUtil class
 * @author angelcereijo
 *
 */
public class QuartzException extends Exception {
	
	public static final int GENERAL_EXCEPTION = 0;
	
	private static final String GENERAL_EXCEPTION_DESC = "General error in Quartz";
	
	//Map for join codes and descriptions
	private final static Map<Integer, String> MAP_CODE_DESCRIPTION = 
		new HashMap<Integer, String>();
	{
		MAP_CODE_DESCRIPTION.put(GENERAL_EXCEPTION, GENERAL_EXCEPTION_DESC);
	}
	
	private int exceptionType;
	private String exceptionTypeDesc;
	
	/**
	 * 
	 * @param exceptionType one of the valid exception codes.
	 */
	public QuartzException(int exceptionType){
		setExceptionType(exceptionType);
		setExceptionTypeDesc(MAP_CODE_DESCRIPTION.get(exceptionTypeDesc));
	}
	
	
	private void setExceptionType(int exceptionType) {
		this.exceptionType = exceptionType;
		
	}
	
	private void setExceptionTypeDesc(String exceptionTypeDesc) {
		this.exceptionTypeDesc = exceptionTypeDesc;
	}
	
	public int getExceptionType() {
		return exceptionType;
	}
	
	public String getExceptionTypeDesc() {
		return exceptionTypeDesc;
	}
	
}
